<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!--      <el-form-item label="出库单号" prop="PICKINGID">
        <el-input
          v-model="queryParams.PICKINGID"
          placeholder="请输入出库单号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="putinId">-->
<!--        <el-input-->
<!--          v-model="queryParams.putinId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="putinIdLine">-->
<!--        <el-input-->
<!--          v-model="queryParams.putinIdLine"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="DOCCTNUMBER">-->
<!--        <el-input-->
<!--          v-model="queryParams.DOCCTNUMBER"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="物料编号" prop="goodId">
        <el-input
          v-model="queryParams.goodId"
          placeholder="请输入物料编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库位编号" prop="locId">
        <el-input
          v-model="queryParams.locId"
          placeholder="请输入库位编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="SPECIFICATION">-->
<!--        <el-input-->
<!--          v-model="queryParams.SPECIFICATION"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="productionDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.productionDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择${comment}">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="wareDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.wareDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择${comment}">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="providerId">-->
<!--        <el-input-->
<!--          v-model="queryParams.providerId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="UNIT">-->
<!--        <el-input-->
<!--          v-model="queryParams.UNIT"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="REMARK">-->
<!--        <el-input-->
<!--          v-model="queryParams.REMARK"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="outId">-->
<!--        <el-input-->
<!--          v-model="queryParams.outId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="scaleUnit">-->
<!--        <el-input-->
<!--          v-model="queryParams.scaleUnit"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="storageAreaId">-->
<!--        <el-input-->
<!--          v-model="queryParams.storageAreaId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="storageId">-->
<!--        <el-input-->
<!--          v-model="queryParams.storageId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="托盘号" prop="CTL">
        <el-input
          v-model="queryParams.CTL"
          placeholder="请输入托盘号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>-->
      <el-form-item label="产品型号" prop="barcode">
        <el-input
          v-model="queryParams.BARCODE"
          placeholder="请输入产品型号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="ToWhseloc">-->
<!--        <el-input-->
<!--          v-model="queryParams.ToWhseloc"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="目的库位" prop="EoutStand">
        <el-input
          v-model="queryParams.EoutStand"
          placeholder="请输入目的库位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="出库类型" prop="typests">
        <el-select v-model="queryParams.typests" placeholder="请选择出库类型" clearable>
          <el-option
            v-for="dict in dict.type.typests"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="ProDucLotId">-->
<!--        <el-input-->
<!--          v-model="queryParams.ProDucLotId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="BARCODE">-->
<!--        <el-input-->
<!--          v-model="queryParams.BARCODE"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="物料名称" prop="goodsName">-->
<!--        <el-input-->
<!--          v-model="queryParams.goodsName"-->
<!--          placeholder="请输入物料名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="PROT">-->
<!--        <el-input-->
<!--          v-model="queryParams.PROT"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="goodsMeasureId">-->
<!--        <el-input-->
<!--          v-model="queryParams.goodsMeasureId"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="VERSION">-->
<!--        <el-input-->
<!--          v-model="queryParams.VERSION"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="goodsTypeid">-->
<!--        <el-input-->
<!--          v-model="queryParams.goodsTypeid"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->

      <el-form-item label="创建时间" prop="addDatas">
        <el-date-picker
          clearable
          v-model="queryParams.addDatas"
          type="datetimerange"
          range-separator="至"
          start-placeholder="开始日期时间"
          end-placeholder="结束日期时间"
          value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择创建时间范围">
        </el-date-picker>
      </el-form-item>
<!--      <el-form-item label="${comment}" prop="stsErp">-->
<!--        <el-input-->
<!--          v-model="queryParams.stsErp"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="${comment}" prop="EoutStand">-->
<!--        <el-input-->
<!--          v-model="queryParams.EoutStand"-->
<!--          placeholder="请输入${comment}"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['system:BACK:add']"-->
<!--        >新增</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          :disabled="single"-->
<!--          @click="handleUpdate"-->
<!--          v-hasPermi="['system:BACK:edit']"-->
<!--        >修改</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          plain-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['system:BACK:remove']"-->
<!--        >删除</el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['system:BACK:export']"-->
<!--        >导出</el-button>-->
<!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table border
              ref="filterTable" v-loading="loading" :data="BACKList" @selection-change="handleSelectionChange">
<!--
      <el-table-column type="selection" width="55" align="center" />
-->
      <el-table-column
        type="index"
        label="行号"
        width="60"
        align="center"
      />
      <el-table-column label="出库单号" sortable align="center" prop="pickingid" />
      <el-table-column label="产线" sortable align="center" prop="gropSc"/>
<!--
      <el-table-column label=" plcId" align="center" prop="plcId" />
-->
<!--      <el-table-column label="${comment}" align="center" prop="putinId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="putinIdLine" />-->
<!--      <el-table-column label="${comment}" align="center" prop="DOCCTNUMBER" />-->
      <el-table-column label="库位编号" sortable align="center" prop="locId" />
      <el-table-column label="托盘号" sortable align="center" prop="ctl" />
      <el-table-column label="物料编号"  sortable align="center" prop="goodId" />
      <el-table-column label="产品型号" sortable align="center" prop="barcode"/>
      <el-table-column label="目的库位" sortable align="center" prop="eoutStand"/>


<!--
      <el-table-column label="数量" align="center" prop="goodsNum" />
-->
<!--      <el-table-column label="${comment}" align="center" prop="SPECIFICATION" />-->
<!--      <el-table-column label="${comment}" align="center" prop="productionDate" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.productionDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="${comment}" align="center" prop="wareDate" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.wareDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="${comment}" align="center" prop="providerId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="UNIT" />-->
<!--      <el-table-column label="${comment}" align="center" prop="REMARK" />-->
<!--      <el-table-column label="${comment}" align="center" prop="outId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="scaleUnit" />-->
<!--      <el-table-column label="${comment}" align="center" prop="mistockNum" />-->
<!--      <el-table-column label="${comment}" align="center" prop="pickingNum" />-->
<!--      <el-table-column label="${comment}" align="center" prop="PRICE" />-->
<!--      <el-table-column label="${comment}" align="center" prop="storageAreaId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="storageId" />-->

<!--      <el-table-column label="${comment}" align="center" prop="goodsNumSj" />-->

<!--      <el-table-column label="${comment}" align="center" prop="ToWhseloc" />-->
<!--      <el-table-column label="${comment}" align="center" prop="outStand" />-->
<!--      <el-table-column label="${comment}" align="center" prop="status" />-->
      <el-table-column label="出库类型" align="center" prop="typests">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.typests" :value="scope.row.typests"/>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="goodsName" />
<!--      <el-table-column label="${comment}" align="center" prop="packingNum" />-->
<!--      <el-table-column label="${comment}" align="center" prop="ProDucLotId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="BARCODE" />-->

<!--      <el-table-column label="${comment}" align="center" prop="PROT" />-->
<!--      <el-table-column label="${comment}" align="center" prop="goodsMeasureId" />-->
<!--      <el-table-column label="${comment}" align="center" prop="DataType" />-->
<!--      <el-table-column label="${comment}" align="center" prop="VERSION" />-->
<!--      <el-table-column label="${comment}" align="center" prop="goodsTypeid" />-->
      <el-table-column label="数量" align="center" prop="goodsNum" />

      <el-table-column label="创建时间" align="center" prop="addData" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.addData, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
        </template>
      </el-table-column>
<!--      <el-table-column label="${comment}" align="center" prop="endtype" />-->
<!--      <el-table-column label="${comment}" align="center" prop="stsErp" />-->
<!--      <el-table-column label="${comment}" align="center" prop="EoutStand" />-->
<!--      <el-table-column label="${comment}" align="center" prop="SAPMSG" />-->
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['system:BACK:edit']"-->
<!--          >修改</el-button>-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['system:BACK:remove']"-->
<!--          >删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改出库历史查询对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="出库单号" prop="PICKINGID">
          <el-input v-model="form.PICKINGID" placeholder="请输入出库单号" />
        </el-form-item>
        <el-form-item label="${comment}" prop="putinId">
          <el-input v-model="form.putinId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="putinIdLine">
          <el-input v-model="form.putinIdLine" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="DOCCTNUMBER">
          <el-input v-model="form.DOCCTNUMBER" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="物料编号" prop="goodId">
          <el-input v-model="form.goodId" placeholder="请输入物料编号" />
        </el-form-item>
        <el-form-item label="库位编号" prop="locId">
          <el-input v-model="form.locId" placeholder="请输入库位编号" />
        </el-form-item>
        <el-form-item label="${comment}" prop="SPECIFICATION">
          <el-input v-model="form.SPECIFICATION" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="productionDate">
          <el-date-picker clearable
            v-model="form.productionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择${comment}">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="${comment}" prop="wareDate">
          <el-date-picker clearable
            v-model="form.wareDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择${comment}">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="${comment}" prop="providerId">
          <el-input v-model="form.providerId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="UNIT">
          <el-input v-model="form.UNIT" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="REMARK">
          <el-input v-model="form.REMARK" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="outId">
          <el-input v-model="form.outId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="scaleUnit">
          <el-input v-model="form.scaleUnit" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="storageAreaId">
          <el-input v-model="form.storageAreaId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="storageId">
          <el-input v-model="form.storageId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="托盘号" prop="CTL">
          <el-input v-model="form.CTL" placeholder="请输入托盘号" />
        </el-form-item>
        <el-form-item label=" plcId" prop="plcId">
          <el-input v-model="form.plcId" placeholder="请输入 plcId" />
        </el-form-item>
        <el-form-item label="${comment}" prop="ToWhseloc">
          <el-input v-model="form.ToWhseloc" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="outStand">
          <el-input v-model="form.outStand" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="出库类型" prop="typests">
          <el-select v-model="form.typests" placeholder="请选择出库类型">
            <el-option
              v-for="dict in dict.type.typests"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="${comment}" prop="ProDucLotId">
          <el-input v-model="form.ProDucLotId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="BARCODE">
          <el-input v-model="form.BARCODE" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="物料名称" prop="goodsName">
          <el-input v-model="form.goodsName" placeholder="请输入物料名称" />
        </el-form-item>
        <el-form-item label="${comment}" prop="PROT">
          <el-input v-model="form.PROT" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="goodsMeasureId">
          <el-input v-model="form.goodsMeasureId" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="VERSION">
          <el-input v-model="form.VERSION" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="goodsTypeid">
          <el-input v-model="form.goodsTypeid" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="创建时间" prop="addData">
          <el-date-picker clearable
            v-model="form.addData"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择创建时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="${comment}" prop="stsErp">
          <el-input v-model="form.stsErp" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="EoutStand">
          <el-input v-model="form.EoutStand" placeholder="请输入${comment}" />
        </el-form-item>
        <el-form-item label="${comment}" prop="SAPMSG">
          <el-input v-model="form.SAPMSG" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listBACK, getBACK, delBACK, addBACK, updateBACK,listFirst } from "@/api/system/BACK";

export default {
  name: "BACK",
  dicts: ['typests'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出库历史查询表格数据
      BACKList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        PICKINGID: null,
        putinId: null,
        putinIdLine: null,
        DOCCTNUMBER: null,
        goodId: null,
        locId: null,
        goodsNum: null,
        SPECIFICATION: null,
        productionDate: null,
        wareDate: null,
        providerId: null,
        UNIT: null,
        REMARK: null,
        outId: null,
        scaleUnit: null,
        mistockNum: null,
        pickingNum: null,
        PRICE: null,
        storageAreaId: null,
        storageId: null,
        CTL: null,
        goodsNumSj: null,
        plcId: null,
        ToWhseloc: null,
        outStand: null,
        status: null,
        typests: null,
        packingNum: null,
        ProDucLotId: null,
        BARCODE: null,
        goodsName: null,
        PROT: null,
        goodsMeasureId: null,
        DataType: null,
        VERSION: null,
        goodsTypeid: null,
        addData: null,
        addDatas:[],
        endtype: null,
        stsErp: null,
        EoutStand: null,
        SAPMSG: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        plcId: [
          { required: true, message: " plcId不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList1();
  },
  methods: {
    /** 首次查询出库历史查询列表 */
    getList1() {
      this.loading = true;
      listFirst(this.queryParams).then(response => {
        this.BACKList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询出库历史查询列表 */
    getList() {
      this.loading = true;
      listBACK(this.queryParams).then(response => {
        this.BACKList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        PICKINGID: null,
        putinId: null,
        putinIdLine: null,
        DOCCTNUMBER: null,
        goodId: null,
        locId: null,
        goodsNum: null,
        SPECIFICATION: null,
        productionDate: null,
        wareDate: null,
        providerId: null,
        UNIT: null,
        REMARK: null,
        outId: null,
        scaleUnit: null,
        mistockNum: null,
        pickingNum: null,
        PRICE: null,
        storageAreaId: null,
        storageId: null,
        CTL: null,
        goodsNumSj: null,
        plcId: null,
        ToWhseloc: null,
        outStand: null,
        status: null,
        typests: null,
        packingNum: null,
        ProDucLotId: null,
        BARCODE: null,
        goodsName: null,
        PROT: null,
        goodsMeasureId: null,
        DataType: null,
        VERSION: null,
        goodsTypeid: null,
        addData: null,
        endtype: null,
        stsErp: null,
        EoutStand: null,
        SAPMSG: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.PICKINGID)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加出库历史查询";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const PICKINGID = row.PICKINGID || this.ids
      getBACK(PICKINGID).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改出库历史查询";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.PICKINGID != null) {
            updateBACK(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBACK(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const PICKINGIDs = row.PICKINGID || this.ids;
      this.$modal.confirm('是否确认删除出库历史查询编号为"' + PICKINGIDs + '"的数据项？').then(function() {
        return delBACK(PICKINGIDs);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/BACK/export', {
        ...this.queryParams
      }, `BACK_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
